﻿using System;

using System.Collections.Generic;
using System.Text;
using Silvermoon.OpenGL.Native;
using Silvermoon.OpenGL;
using Silvermoon.Core;

namespace Silvermoon.Shapes
{
    /// <summary>
    /// Renders a texture with a drop shadow.
    /// </summary>
    public class ShadowedBackgroundShape : BackgroundShape
    {
        public override void Render(Silvermoon.Core.Renderer renderer)
        {
            bool isShadowed = renderer.Shadowed;
            if (!isShadowed)
            {
                renderer.Shadowed = true;
                gl.Disable(Capability.ScissorTest);
                gl.PushMatrix();
                gl.Translatef(6f, 5f, 0f);
                base.Render(renderer);
                gl.PopMatrix();
                gl.Enable(Capability.ScissorTest);
                renderer.Shadowed = false;
            }
            base.Render(renderer);
        }

        protected override Shape CreateClone()
        {
            return new ShadowedBackgroundShape();
        }
    }
}
